//
//  CWJavaScriptContext.h
//  CWDevelop
//
//  Created by LittoCats on 7/9/14.
//  Copyright (c) 2014 Littocats. All rights reserved.
//

#import <Foundation/Foundation.h>

#define kJavaScriptContextKey @"kJavaScriptContextPIDKey_Littocats"
#define kJavaScriptAPIKey @"kJavaScriptContextAPIKey_Littocats"

@interface CWJavaScriptContext : NSObject
/**
 *  context
 */
+ (instancetype)context;

/**
 *  evaluate a javascript string
 */
- (id)evaluateScript:(NSString *)script;

- (id)callFunction:(NSString *)func withArguments:argument,... NS_REQUIRES_NIL_TERMINATION;

- (NSString *)analyzeResourcePath:(NSString *)path;
@end

@interface CWScriptFunction : NSObject

@property (nonatomic, readonly) NSString *functionId;
@property (nonatomic, readonly) NSString *functionName;
@property (nonatomic, readonly) NSString *contextId;

+ (instancetype)functionWithFunctionScript:(NSString *)func context:(NSString *)contextId;

- (id)evaluateWithArguments:argument,... NS_REQUIRES_NIL_TERMINATION;
@end